import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LEGION
 * Date: 2023-04-19
 * Time: 21:08
 */
public class J230420 {
    static int a = 0;
    public static void Hanoi(int n,char A,char B,char C) {
        a++;
        if (n == 1) {
        } else {
            Hanoi(n - 1, A, C, B);
            Hanoi(n - 1, B, A, C);
        }
    }
   public static void main(String[] args) {
       System.out.println("请输入盘子总数n:");
       Scanner in = new Scanner(System.in);
       int n = in.nextInt();
       Hanoi(n, 'A', 'B', 'C');
       System.out.println(a);
   }
    public static void main7(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入n：");
        int n=sc.nextInt();
        System.out.println(jieC(n));
    }
    public static int jieC(int n){
        if(n == 1){
            return 1;
        }else {
            return n*jieC(n-1);
        }
    }



    public static void main6(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入n：");
        int n=sc.nextInt();
        System.out.println(fib(n));
    }
    public static int fib(int a){
        if(a == 1){
            return 1;
        }
        if(a == 2){
            return 1;
        }
        int f1 = 1;
        int f2 = 1;
        int f3 = 0;
        for (int i = 3; i <= a ; i++) {
            f3 = f1+f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }
    public static void main5(String[] args) {
        System.out.println(max(1.5,8.4,7.6));
    }
    public static int max(int x,int y){
        return x>y?x:y;
    }
    public static double max(double x,double y,double z){
        double max = x;
        if(y>x){
            max = y;
        }
        if(z>max){
            max = z;
        }
        return max;
    }
    public static void main4(String[] args) {
        System.out.println(add(1.2,1.6,4.8));
    }
    public static int add(int x,int y){
        return x+y;
    }
    public static double add(double x,double y,double z){
        return x+y+z;
    }

    public static void main3(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入n：");
        int n=sc.nextInt();
        long num = 0;
        for (int i = 1; i <= n ; i++) {
            int a = 1;
            for (int j = 1; j <= i ; j++) {
                a *= j;
            }
            num += a;
        }
        System.out.println(num);
    }
    public static void main2(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a=1;
        for (int i = 1; i <= n ; i++) {
            a *= i;
        }
        System.out.println(a);
    }
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入第一个数：");
        int a1=sc.nextInt();
        System.out.print("请输入第二个数：");
        int a2=sc.nextInt();
        System.out.print("请输入第三个数：");
        int a3=sc.nextInt();
        System.out.println("三个数中最大的是："+ max3(a1,a2,a3));
    }
    public static int max3(int n1,int n2,int n3){
        int m1=max2(n1,n2);
        return max2(m1,n3);
    }

    public static int max2(int n1, int n2) {
        return n1 > n2?n1:n2;
    }

}
